import nme.geom.Rectangle;
import nme.geom.Point;
import nme.geom.Matrix;

import nme.display.BitmapData;
import nme.display.Graphics;
import nme.display.Sprite;

import nme.text.TextFieldAutoSize;
import nme.text.TextField;
import nme.text.TextFormat;
import nme.Vector;
import nme.Assets;

class DumpObj extends Sprite
{
	private var _rect:Rectangle;
	private var _bgColor:Int;
	private var _bgAlpha:Float;
	private var _bColor:Int;
	private var _bAlpha:Float;
	public function new (rootx:Float, rooty:Float, rx:Float, ry:Float, rw:Float, rh:Float, background:Int, border:Int, alphaBackground:Float = 0.5, alphaBorder:Float = 0.5)
	{
		super ();
		this.x = rootx;
		this.y = rooty;
		
		_rect = new Rectangle (rx, ry, rw, rh);
		_bgColor = background;
		_bColor = border;
		_bgAlpha = alphaBackground;
		_bAlpha = alphaBorder;
		render ();
	}
	
	public function render ():Void
	{
		graphics.clear ();
		graphics.beginFill (_bgColor, _bgAlpha);
		graphics.lineStyle (1, _bColor, _bAlpha);
		graphics.drawRect (_rect.x, _rect.y, _rect.width, _rect.height);
		graphics.endFill();
	}
	
	public function setRect (rx:Float, ry:Float, rw:Float, rh:Float):Void
	{
		_rect.x = rx;
		_rect.y = ry;
		_rect.width = rw;
		_rect.height = rh;
	}
	
	public function setX (rx:Float):Void
	{
		_rect.x = rx;
	}
	
	public function setY (ry:Float):Void
	{
		_rect.y = ry;
	}
	
	public function setPosition (rx:Float, ry:Float):Void
	{
		_rect.x = rx;
		_rect.y = ry;
	}
	
	public function translate (dx:Float, dy:Float):Void
	{
		_rect.x += dx;
		_rect.y += dy;
	}
	
	public function setWidth (rw:Float):Void
	{
		_rect.width = rw;
	}
	
	public function setHeight (rh:Float):Void
	{
		_rect.height = rh;
	}
	
	public function setSize (rw:Float, rh:Float):Void
	{
		_rect.width = rw;
		_rect.height = rh;
	}
}